Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Changes

Bash tool validation:

  • Empty or whitespace-only scripts now fail immediately with a clear error
  • Prevents confusing behavior from malformed tool calls
  • Returns exitCode: -1 and wall_duration_ms: 0 for instant feedback

Makefile fix:

  • make typecheck now depends on dist/version.txt
  • Automatically generates version file before type checking
  • Eliminates "Cannot find module './version'" errors

Testing

Added two tests in bash.test.ts:

  • Empty script ("")
  • Whitespace-only script (" \n\t ")

All 233 tests pass ✅

Generated with cmux

Previously, bash tool overflow errors gave generic messages that didn't
help agents understand what went wrong or how much data was processed.

Changes:
- Track specific overflow reason (line too long, total bytes exceeded, or max lines exceeded)
- Include actual values in error messages (bytes read, line count, etc.)
- Show which limit was violated with comparison (e.g., '17000 bytes > 16384 bytes')
- Update overflow message format to include specific reason upfront
- Improve fallback error when temp file creation fails

Example new messages:
- 'Line 50 exceeded per-line limit: 2048 bytes > 1024 bytes'
- 'Total output exceeded limit: 17000 bytes > 16384 bytes (at line 200)'
- 'Line count exceeded limit: 300 lines >= 300 lines (15000 bytes read)'

This gives agents actionable information to adjust their commands
(e.g., add grep filters, use head/tail with correct line counts).

_Generated with `cmux`_
The error message changed from "lines saved to" to "lines) saved to",
breaking the regex that extracts the temp file path. Updated regex to
be more flexible and match both formats.
Updated assertions to check for new overflow error messages
("Line count exceeded limit" or "OUTPUT OVERFLOW") instead of
the old generic "output exceeded limits" text.
- Add validation to reject empty or whitespace-only scripts
- Fail immediately with clear error message for malformed tool calls
- Add tests for empty script validation
- Fix typecheck Makefile target to depend on version file generation
@ammario ammario enabled auto-merge October 9, 2025 04:03
@ammario ammario added this pull request to the merge queue Oct 9, 2025
Merged via the queue into main with commit d6cbe2e Oct 9, 2025
6 checks passed
@ammario ammario deleted the validate-empty-bash-script branch October 9, 2025 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants